{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.list}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>用户列表</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 用户列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    {include file="public/top_action" /}
                    <div class="box-tools" style="top:10px;">
                        <form action="{:search_url('search')}" method="GET" pjax-search="">
                            <div class="input-group input-group-sm" style="width:300px;">
                                {$salonSelect}

                                <input type="text" name="search" class="form-control" value="{:input('get.search')}" placeholder="{$Think.lang.search}"  style="float: left;width: 120px"/>
                                <div class="input-group-btn"><button type="submit" class="btn btn-default sreachs"><i class="fa fa-search"></i></button></div>
                            </div>
                        </form>
                    </div>
                    &nbsp;&nbsp;&nbsp;
                    <div class="pull-left">
                        <a class="btn btn-sm" href="/admin/order/pay"></i> 付款</a>
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover table-sort">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>{$Think.lang.id}{:table_sort('id')}</th>
                            <th>{$Think.lang.name}</th>
                            <th>{$Think.lang.order_id}</th>
                            <th>{$Think.lang.operation}</th>
                            <th>{$Think.lang.assistant}</th>
                            <th>{$Think.lang.remark}</th>
                            
                            <th>{$Think.lang.number}{:table_sort('number')}</th>
                            <th>{$Think.lang.price}{:table_sort('price')}</th>
                            <th>{$Think.lang.total}{:table_sort('total')}</th>
                            <th>{$Think.lang.pay_type}</th>
                            <th>{$Think.lang.status}{:table_sort('status')}</th>
                            <th>{$Think.lang.parent}</th>
                            <th width="204">{$Think.lang.action}</th>
                        </tr>
                        {volist name="dataList" id="vo"}
                        <tr>
                            <td style="vertical-align:middle"><input type="checkbox" name="id[]" value="{$vo.id}" class="minimal"></td>
                            <td style="vertical-align:middle">{$vo.id}</td>
                            
                            <td style="vertical-align:middle">
                             {$vo->user->name}
                            </td>
                            
                            <td style="vertical-align:middle">{$vo->order_id}</td>
                            <td style="vertical-align:middle">
                             {$vo->operation}
                            </td>
                            <td style="vertical-align:middle">
                             {$vo->assistant}
                            </td>
                            <td style="vertical-align:middle">
                             {$vo->remark}
                            </td>
                           <!--  <td style="vertical-align:middle">
                             {$vo->archive->title}
                            </td> -->
                            <td style="vertical-align:middle">
                              {$vo->number}
                            </td>
                            <td style="vertical-align:middle">{$vo->price}</td>
                            <td style="vertical-align:middle">
                            <span class="editable" data-pk="{$vo.id}" data-name="total" data-url="{:url(CONTROLLER_NAME.'/edit', 'id='.$vo['id'])}" >
                             {$vo->total}
                            </span></td>
                            <td style="vertical-align:middle">
                            {switch name="vo->pay_type" }
                                {case value="1"}微信{/case}
                                {case value="2"}支付宝{/case}
                                {case value="3"}现金{/case}
                                {default /}积分
                            {/switch}
                            </td>
                            <td style="vertical-align:middle">
                                {switch name="vo->status" }
                                    {case value="1"}已付款{/case}
                                    {default /}待付款
                                {/switch}
                            </td>
                            <td style="vertical-align:middle">
                              {$vo->parent}
                            </td>
                            <td style="vertical-align:middle">
                                {eq name="vo->status" value="0"}
                                {:authAction(CONTROLLER_NAME.'/authGroup', 'auth_group', ['id' => $vo.id])}
                                {:authAction(CONTROLLER_NAME.'/receipt', 'receipt', $vo.id)}
                                {:authAction(CONTROLLER_NAME.'/delete', 'delete', $vo.id)}
                                {/eq}
                            </td>

                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$dataList->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });
    
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({language:"zh-CN"});
    
    /*全选-反选*/
    $('.checkbox-toggle').on('ifChecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("check");
    });
    $('.checkbox-toggle').on('ifUnchecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("uncheck");
    });
    
    $('.editable').editable({
        emptytext: "empty",
        params: function(params) {      //参数
            var data = {};
            data['id'] = params.pk;
            data[params.name] = params.value;
            return data;
        },
        success: function(response, newValue) {
            var res = $.parseJSON( response );
            if(res.status == 1){
            }else{
                return res.info;
            }
        }
    });
    
    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}